package com.lizheng.yunservice.travel.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lizheng.yunservice.common.page.TableDataInfo;
import com.lizheng.yunservice.travel.doamin.vo.CulturalVideoVO;
import com.lizheng.yunservice.travel.mapper.CulturalVideoMapper;
import com.lizheng.yunservice.travel.model.CulturalVideoPageDTO;
import com.lizheng.yunservice.travel.service.CulturalVideoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class CulturalVideoServiceImpl implements CulturalVideoService {

    @Resource
    private CulturalVideoMapper culturalVideoMapper;

    @Override
    public TableDataInfo<CulturalVideoVO> videoPage(CulturalVideoPageDTO dto) {
        Page<CulturalVideoVO> page = new Page<>(dto.getPageNum(), dto.getPageSize());
        IPage<CulturalVideoVO> result = culturalVideoMapper.selectVideoPage(page, dto);
        return TableDataInfo.build(result.getRecords(), result.getTotal());
    }
}